package xujiwen.transport.servlet;

import xujiwen.transport.Mgr.UserMgr;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class for Servlet: Register
 * 
 */
public class DelUser extends javax.servlet.http.HttpServlet implements
		javax.servlet.Servlet {
	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public DelUser() {
		super();
	}

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request,
	 *      HttpServletResponse response)
	 */
	@Override
	protected void doGet(final HttpServletRequest request,
			final HttpServletResponse response) throws ServletException,
			IOException {
		// TODO Auto-generated method stub
	}

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request,
	 *      HttpServletResponse response)
	 */
	@Override
	protected void doPost(final HttpServletRequest request,final HttpServletResponse response) throws ServletException,IOException {
		
		try {
		final int uid = Integer.parseInt(request.getParameter("delid"));
		//final int uclass = Integer.parseInt(request.getParameter("uclass"));
		//final User user = new User();
		UserMgr um = new UserMgr();
		um.Del(uid);
		System.out.println("删除成功");
		}catch(final NumberFormatException nfex){
			//response.sendRedirect("err.jsp");
			System.out.println("提交错误");			
			return ;
		}
		response.sendRedirect("admin/operatorMgr.jsp?searchStr=");
	}
}